package com.yzdmw.toutiao.service;

import com.yzdmw.toutiao.model.LoggedInUser;
import com.yzdmw.toutiao.model.Response;

import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface UserService {
    @FormUrlEncoded
    @POST("user/login")
    Observable<Response<String>> login(@Field("username") String username,
                                       @Field("password") String password);
    @FormUrlEncoded
    @POST("user/regist")
    Observable<Response<String>> regist(@Field("username") String username,
                                      @Field("password") String password);

    @FormUrlEncoded
    @POST("user/logout")
    Observable<Response<String>> logout(@Query("token") String token);

    @FormUrlEncoded
    @POST("user/info")
    Observable<Response<LoggedInUser>> getUserInfo(@Field("username") String username,
                                                   @Query("token") String token);
}
